package com.boge.modules.house.controller;

import java.util.Arrays;
import java.util.Map;

import com.boge.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.boge.modules.house.entity.THousepjEntity;
import com.boge.modules.house.service.THousepjService;
import com.boge.common.utils.PageUtils;
import com.boge.common.utils.R;



/**
 * 
 *
 * @author boge
 * @email dengpbs@163.com
 * @date 2024-12-11 12:51:26
 */
@RestController
@RequestMapping("house/thousepj")
public class THousepjController {
    @Autowired
    private THousepjService tHousepjService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("house:thousepj:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tHousepjService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("house:thousepj:info")
    public R info(@PathVariable("id") Integer id){
		THousepjEntity tHousepj = tHousepjService.getById(id);

        return R.ok().put("tHousepj", tHousepj);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("house:thousepj:save")
    public R save(@RequestBody THousepjEntity tHousepj){
        Long userId = ShiroUtils.getUserId();
        tHousepj.setUserId(userId.intValue());
        tHousepjService.save(tHousepj);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("house:thousepj:update")
    public R update(@RequestBody THousepjEntity tHousepj){
		tHousepjService.updateById(tHousepj);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("house:thousepj:delete")
    public R delete(@RequestBody Integer[] ids){
		tHousepjService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
